import os
from multiprocessing import Process


def task(name):
    print(f"子进程 {name} PID: {os.getpid()}")


if __name__ == "__main__":
    processes = []
    for i in range(2):
        p = Process(target=task, args=(i,))
        processes.append(p)
        p.start()
    for p in processes:
        p.join()
